import time

from yk.Page.Page import Page
from selenium import webdriver
from selenium.webdriver.common.by import By


class Page1(Page):
    # 断言2 187****5065@163.com
    dy2_loc = (By.XPATH, '//*[@id="spnUid"]')

    def dy2(self):
        self.text(self.dy2_loc)

    # 点击写信
    xiexin_loc = (By.XPATH, '//*[@id="_mail_component_98_98"]/span[2]')

    def xiexin(self):
        self.cilck(self.xiexin_loc)

    # 输入收件人：class_name
    shoujianren_loc = (By.CLASS_NAME, 'js-component-emailcontainer nui-multiLineIpt C-multiLineIpt nui-ipt')

    def shoujianren(self):
        self.send_keys(self.shoujianren_loc, 'dmn')

    # 输入主题：css
    zhuti_loc = (By.CSS_SELECTOR, '#\31 760320655347_subjectInput')

    def zhuti(self):
        self.send_keys(self.zhuti_loc, '月考')

    # 点击内容
    dianneirong_loc = (By.XPATH, '/html/body')

    def dianneirong(self):
        self.cilck(self.dianneirong_loc)

    # 输入内容
    shuneirong_loc = (By.XPATH, '/html/body')

    def shuneirong(self):
        self.send_keys(self.shuneirong_loc, '段萌娜月考')

    # 点击发送
    fasong_loc = (By.XPATH, '/html/body/div[2]/div[1]/div/div[1]/section/footer/div[1]/span[2]')

    def fasong(self):
        self.cilck(self.fasong_loc)

    def text_02(self):

            self.text_01()
            # 断言2
            print(self.dy2())
            self.xiexin()
            time.sleep(3)
            self.shoujianren()
            time.sleep(3)
            self.zhuti()
            time.sleep(3)
            # 进入框架
            self.jinru('//*[@id="_mail_editor_0_283"]/div[1]/div[2]/div/iframe')
            self.dianneirong()
            time.sleep(3)
            self.shuneirong()
            time.sleep(3)
            self.tui()
            self.fasong()
            time.sleep(3)

